Duration versus effort
Duration is how long a task takes in actual working hours in the schedule. If the task begins at 8:00 and ends at 12:00, that's a duration of 4 hours. Note that non-working times don't count; if a task starts one afternoon and doesn't complete until the next morning, or spans a lunch break, only the working hours are counted. Also note that the resources assigned to a task may have different working hours than the project as a whole, and thus the displayed duration of a task may not match up exactly with the amount of effort it takes.
Effort is the total amount of working time put into a task by all assigned resources. A task with a duration of 4 hours, with 2 resources assigned at 100%, has an effort value of 8 hours. Note that Material resources don't contribute to effort, only Staff and Equipment resources do.
The duration and the effort of a task can change depending on the resources you assign.
Determining which value to recalculate Each task has a setting in its Assignments inspector which controls whether to keep the duration fixed, the effort fixed, or both.
When you assign or unassign staff and equipment resources, the value that isn't fixed re-calculates its value; the other field stays the same. Regardless of which value is calculated, you can always edit either value manually.
If both values are fixed, then assigning resources changes the assigned percentage.
What Makes Duration and Effort Change Number of Assigned Resources — Assigning more resources to a task generally causes the task to take less time, because the required effort gets completed sooner.
Efficiency of Assigned Resources — Assigning less-efficient resources to a task causes the duration to be longer than the effort, because the resource takes more time to achieve the same amount of effort.
Assigned Amount and Available Units — Assigning fewer units of a resource to a task causes the duration to be longer than the effort, because less of the resource's time and energy is being spent on that task. This situation is common when a resource is split between multiple tasks at one time. The amount of a resource you can assign to tasks depends on the resource's available Units (set in the Resource Information inspector or the Units column of the Resource outline). Assigning more of a resource than is available causes a violation and shows up as overutilization in the Resource timeline.